Kanzi 3.9.10
kanzi::TextConceptImpl< TDerivedClass > Class Template Reference

TextConceptImpl provides the common base implementation for text rendering nodes. More...

#include <kanzi/ui/node/concept/text_concept.hpp>

Inheritance diagram for kanzi::TextConceptImpl< TDerivedClass >:
[legend]

Public Member Functions

ColorRGBA getFontColor () const
 Gets the value of the FontColorProperty.
 
MaterialSharedPtr getFontMaterial () const
 Gets the value of the FontMaterialProperty.
 
bool getHorizontalFit () const
 Gets the value of the HorizontalFitProperty.
 
Vector2 getHorizontalFitScaleLimits () const
 Gets the value of the HorizontalFitScaleLimitsProperty.
 
Vector2 getHorizontalPadding () const
 Gets the value of HorizontalPaddingProperty.
 
string getOverflow () const
 Gets the value of the OverflowProperty.
 
bool getRemoveSideBearings () const
 Gets the value of the RemoveSideBearingsProperty.
 
string getText () const
 Gets the value of TextProperty.
 
TextFormat::TextHorizontalAlignment getTextHorizontalAlignment () const
 Gets the value of the TextHorizontalAlignmentProperty.
 
TextFormat::TextVerticalAlignment getTextVerticalAlignment () const
 Gets the value of the TextVerticalAlignmentProperty.
 
TextFormat::Truncation getTruncation () const
 Gets the value of the TruncationProperty.
 
TextFormat::TruncationDirection getTruncationDirection () const
 Gets the value of the TruncationDirectionProperty.
 
Vector2 getVerticalPadding () const
 Gets the value of VerticalPaddingProperty.
 
void setFontColor (ColorRGBA value)
 Sets the value of the FontColorProperty.
 
void setFontMaterial (MaterialSharedPtr value)
 Sets the value of the FontMaterialProperty.
 
void setHorizontalFit (bool value)
 Sets the value of the HorizontalFitProperty.
 
void setHorizontalFitScaleLimits (Vector2 value)
 Sets the value of the HorizontalFitScaleLimitsProperty.
 
void setHorizontalPadding (Vector2 value)
 Sets the value of HorizontalPaddingProperty.
 
void setOverflow (string_view value)
 Sets the value of the OverflowProperty.
 
void setRemoveSideBearings (bool value)
 Sets the value of the RemoveSideBearingsProperty.
 
void setText (string value)
 Sets the value of TextProperty.
 
void setTextHorizontalAlignment (TextFormat::TextHorizontalAlignment value)
 Sets the value of the TextHorizontalAlignmentProperty.
 
void setTextVerticalAlignment (TextFormat::TextVerticalAlignment value)
 Sets the value of the TextVerticalAlignmentProperty.
 
void setTruncation (TextFormat::Truncation value)
 Sets the value of the TruncationProperty.
 
void setTruncationDirection (TextFormat::TruncationDirection value)
 Sets the value of the TruncationDirectionProperty.
 
void setVerticalPadding (Vector2 value)
 Sets the value of VerticalPaddingProperty.
 
virtual ~TextConceptImpl ()=default
 Destructor.
 
- Public Member Functions inherited from kanzi::TextConcept
virtual ~TextConcept ()=default
 Destructor.
 

Static Public Member Functions

static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 
- Static Public Member Functions inherited from kanzi::TextConcept
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 

Protected Member Functions

void prepareTextFormat (const TextFormatParameters &parameters, string text)
 Updates the parameters and text of the internal text format.
 
 TextConceptImpl ()=default
 Constructor.
 

Protected Attributes

TextFormatPtr m_textFormat
 The text format for the text that this node displays.
 

Additional Inherited Members

- Static Public Attributes inherited from kanzi::TextConcept
static PropertyType< ColorRGBAFontColorProperty
 Sets the text color for the default font material and for the materials with a fragment shader that uses the FontColor uniform.
 
static PropertyType< ResourceSharedPtrFontMaterialProperty
 Sets the material whose shader is used to render the text in a 3D text node.
 
static PropertyType< string > TextProperty
 Sets the text content that a text node renders.
 
static PropertyType< TextFormat::TextHorizontalAlignmentTextHorizontalAlignmentProperty
 Sets the horizontal alignment of the text in a text node.
 
static PropertyType< TextFormat::TextVerticalAlignmentTextVerticalAlignmentProperty
 Sets the vertical alignment of the text in a text node.
 
static PropertyType< Vector2HorizontalPaddingProperty
 Sets the padding spaces between the content and the left and right boundaries of a text node.
 
static PropertyType< Vector2VerticalPaddingProperty
 Sets the padding spaces between the content and the top and bottom boundaries of a text node.
 
static PropertyType< string > OverflowProperty
 Sets the characters that represent the truncated text when the text string to be rendered is too long to fit in a text node.
 
static PropertyType< TextFormat::TruncationTruncationProperty
 Sets how to truncate the text when the text string to be rendered is too long to fit in a node.
 
static PropertyType< TextFormat::TruncationDirectionTruncationDirectionProperty
 Sets which part of the text to truncate when the text string to be rendered is too long to fit in a node.
 
static PropertyType< boolRemoveSideBearingsProperty
 Sets the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text exactly within the boundary of the text node.
 
static PropertyType< boolHorizontalFitProperty
 Allows a Text Block to scale glyphs horizontally when the text string is too long to fit in that Text Block.
 
static PropertyType< Vector2HorizontalFitScaleLimitsProperty
 Sets the scale range that the HorizontalFitProperty can use when it scales the text horizontally.
 

Detailed Description

template<typename TDerivedClass>
class kanzi::TextConceptImpl< TDerivedClass >

TextConceptImpl provides the common base implementation for text rendering nodes.

It encapsulates TextFormat, which is responsible for text layouting and rendering.

TextConceptImpl derives from TextConcept, which defines the data and property types used by the implementation. Do not use these classes directly. Instead use:

To implement your own text rendering node:

  1. Derive from TextConceptImpl and FontStyleConceptImpl.
  2. Implement the void notifyPostPrepareTextFormat(bool) method.

    Kanzi calls this method after the underlying TextFormat updates the layout of the text. The only boolean parameter of this function indicates whether the text was relayouted.

  3. To update the text layout, call prepareTextFormat().

    Kanzi updates the underlying TextFormat with the parameters that you pass to the function and the parameters taken from FontStyleConceptImpl.

  4. To render text use the TextConceptImpl::m_textFormat member.
Since
Kanzi 3.9.0

Constructor & Destructor Documentation

◆ ~TextConceptImpl()

Destructor.

◆ TextConceptImpl()

template<typename TDerivedClass >
kanzi::TextConceptImpl< TDerivedClass >::TextConceptImpl ( )
explicitprotecteddefault

Constructor.

Member Function Documentation

◆ makeEditorInfo()

◆ getFontColor()

template<typename TDerivedClass >
ColorRGBA kanzi::TextConceptImpl< TDerivedClass >::getFontColor ( ) const

Gets the value of the FontColorProperty.

Returns
The color value of the default font material, or the color value of materials with fragment shader that uses the FontColor uniform. Returns the value in range [0,1].
See also
setFontColor()

◆ setFontColor()

Sets the value of the FontColorProperty.

Parameters
valueThe ColorRGBA color value of the font material with fragment shader that uses the FontColor uniform.
See also
getFontColor()

◆ getFontMaterial()

Gets the value of the FontMaterialProperty.

Returns
The font material currently in use.
See also
setFontMaterial()

◆ setFontMaterial()

Sets the value of the FontMaterialProperty.

Parameters
valueThe font material.
See also
getFontMaterial()

◆ getHorizontalPadding()

template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalPadding ( ) const

Gets the value of HorizontalPaddingProperty.

Returns
The space on the left and the right sides of the content.
See also
setHorizontalPadding()

◆ setHorizontalPadding()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalPadding ( Vector2 value)

Sets the value of HorizontalPaddingProperty.

Parameters
valueThe space on the left and the right sides of the content.
See also
getHorizontalPadding()

◆ getText()

template<typename TDerivedClass >
string kanzi::TextConceptImpl< TDerivedClass >::getText ( ) const

Gets the value of TextProperty.

See also
setText()

◆ setText()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setText ( string value)

Sets the value of TextProperty.

See also
getText()

◆ getTextHorizontalAlignment()

Gets the value of the TextHorizontalAlignmentProperty.

Returns
The horizontal alignment of the object.
See also
setTextHorizontalAlignment()

◆ setTextHorizontalAlignment()

Sets the value of the TextHorizontalAlignmentProperty.

Parameters
valueOne of the TextFormat::TextHorizontalAlignment enumerator values.
See also
getTextHorizontalAlignment()

◆ getTextVerticalAlignment()

Gets the value of the TextVerticalAlignmentProperty.

Returns
The vertical alignment of the object.
See also
setTextVerticalAlignment()

◆ setTextVerticalAlignment()

Sets the value of the TextVerticalAlignmentProperty.

Parameters
valueOne of the TextFormat::TextVerticalAlignment enumerator values.
See also
getTextVerticalAlignment()

◆ getVerticalPadding()

template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getVerticalPadding ( ) const

Gets the value of VerticalPaddingProperty.

Returns
The space on the top and the bottom of the content.
See also
setVerticalPadding()

◆ setVerticalPadding()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setVerticalPadding ( Vector2 value)

Sets the value of VerticalPaddingProperty.

Parameters
valueThe space on the top and the bottom of the content.
See also
getVerticalPadding()

◆ getOverflow()

template<typename TDerivedClass >
string kanzi::TextConceptImpl< TDerivedClass >::getOverflow ( ) const

Gets the value of the OverflowProperty.

Returns
The characters that represent the truncated text when the text string is too long to fit in the node.
See also
setOverflow()

◆ setOverflow()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setOverflow ( string_view value)

Sets the value of the OverflowProperty.

Parameters
valueThe characters that represent the truncated text when the text string is too long to fit in the node.
See also
getOverflow()

◆ getHorizontalFit()

template<typename TDerivedClass >
bool kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFit ( ) const

Gets the value of the HorizontalFitProperty.

Returns
If the Text Block allows horizontal scaling of glyphs, true, otherwise false.

◆ setHorizontalFit()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFit ( bool value)

Sets the value of the HorizontalFitProperty.

Parameters
valueWhether to enable the horizontal scaling of glyphs when the text string is too long to fit in that Text Block.

◆ getHorizontalFitScaleLimits()

template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFitScaleLimits ( ) const

Gets the value of the HorizontalFitScaleLimitsProperty.

Returns
The minimum and maximum amount to which the HorizontalFitProperty can scale the glyphs in a Text Block node.

◆ setHorizontalFitScaleLimits()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFitScaleLimits ( Vector2 value)

Sets the value of the HorizontalFitScaleLimitsProperty.

Parameters
valueWhen the HorizontalFitProperty is enabled, sets the minimum and maximum scale for glyphs when the width of text in a Text Block does not match the Layout Width property of that Text Block. For example:
  • Min property field set to 1.0 does not squeeze the glyphs, while 0.5 allows squeezing the glyphs to half their size.
  • Max property field set to 1.0 does not stretch the glyphs, while 2.0 allows stretching the glyphs to double their size.

◆ getRemoveSideBearings()

template<typename TDerivedClass >
bool kanzi::TextConceptImpl< TDerivedClass >::getRemoveSideBearings ( ) const

Gets the value of the RemoveSideBearingsProperty.

Returns
If the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text are to be exactly within the boundary of the text node, true, otherwise false.

◆ setRemoveSideBearings()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setRemoveSideBearings ( bool value)

Sets the value of the RemoveSideBearingsProperty.

Parameters
valueThe value that determines if the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text are to be exactly within the boundary of the text node or not.

◆ setTruncationDirection()

Sets the value of the TruncationDirectionProperty.

Parameters
valueThe truncation direction for the text that does not fit in the node.
Since
Kanzi 3.9.6

◆ getTruncationDirection()

Gets the value of the TruncationDirectionProperty.

Returns
The truncation direction for the text that does not fit in the node.
Since
Kanzi 3.9.6

◆ setTruncation()

Sets the value of the TruncationProperty.

Parameters
valueTruncation policy for the text that does not fit in the node.
Since
Kanzi 3.9.6

◆ getTruncation()

Gets the value of the TruncationProperty.

Returns
Truncation policy for the text that does not fit in the node.
Since
Kanzi 3.9.6

◆ prepareTextFormat()

template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::prepareTextFormat ( const TextFormatParameters & parameters,
string text )
protected

Updates the parameters and text of the internal text format.

Calls notifyPostPrepareTextFormat() when the text format is created or reused successfully.

Parameters
parametersCollection of parameters that are used to configure the text format.
textThe text that is layouted using the text format.

Member Data Documentation

◆ m_textFormat

The text format for the text that this node displays.


The documentation for this class was generated from the following files: